Imports StartPoint.BR.Interfaces
Imports StartFrame.BR.Interfaces

Namespace Compras.Listados

    Public Class Transacciones
        Inherits StartFrame.US.Listador

        Dim _Transacciones As ITransacciones

#Region " Windows Form Designer generated code "

        Public Sub New()
            MyBase.New()

            'This call is required by the Windows Form Designer.
            InitializeComponent()

            'Add any initialization after the InitializeComponent() call

        End Sub

        'Form overrides dispose to clean up the component list.
        Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
            If disposing Then
                If Not (components Is Nothing) Then
                    components.Dispose()
                End If
            End If
            MyBase.Dispose(disposing)
        End Sub

        'Required by the Windows Form Designer
        Private components As System.ComponentModel.IContainer

        'NOTE: The following procedure is required by the Windows Form Designer
        'It can be modified using the Windows Form Designer.  
        'Do not modify it using the code editor.
        Friend WithEvents cd_proveedor As LnkDesdeHastaFK
        Friend WithEvents cd_estado_trans As LnkDesdeHastaFK
        Friend WithEvents cd_centro_costo As LnkDesdeHastaFK
        Friend WithEvents cd_transaccion As LnkDesdeHastaFK
        Friend WithEvents fe_devengamiento As LnkDesdeHastaFecha
        Friend WithEvents st_contabilizado As LnkControls.LnkCheckBox
        <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
            Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Transacciones))
            Me.cd_estado_trans = New LnkDesdeHastaFK
            Me.cd_proveedor = New LnkDesdeHastaFK
            Me.cd_centro_costo = New LnkDesdeHastaFK
            Me.cd_transaccion = New LnkDesdeHastaFK
            Me.fe_devengamiento = New LnkDesdeHastaFecha
            Me.st_contabilizado = New LnkControls.LnkCheckBox
            Me.Contenedor.SuspendLayout()
            CType(Me.lnk_dataSet, System.ComponentModel.ISupportInitialize).BeginInit()
            '
            'TabPage1
            '
            Me.TabPage1.Name = "TabPage1"
            '
            'cmdMinimizar
            '
            Me.cmdMinimizar.Image = CType(resources.GetObject("cmdMinimizar.Image"), System.Drawing.Image)
            Me.cmdMinimizar.Name = "cmdMinimizar"
            '
            'Contenedor
            '
            Me.Contenedor.Controls.Add(Me.st_contabilizado)
            Me.Contenedor.Controls.Add(Me.fe_devengamiento)
            Me.Contenedor.Controls.Add(Me.cd_transaccion)
            Me.Contenedor.Controls.Add(Me.cd_centro_costo)
            Me.Contenedor.Controls.Add(Me.cd_proveedor)
            Me.Contenedor.Controls.Add(Me.cd_estado_trans)
            Me.Contenedor.Name = "Contenedor"
            '
            'cboReporte
            '
            Me.cboReporte.Name = "cboReporte"
            Me.cboReporte.Size = New System.Drawing.Size(250, 21)
            Me.cboReporte.ValueMember = "ID"
            '
            'lblReporte
            '
            Me.lblReporte.Name = "lblReporte"
            '
            'lblTitulo
            '
            Me.lblTitulo.Name = "lblTitulo"
            Me.lblTitulo.Text = "Transacciones de Compras"
            '
            'StatusBar1
            '

            '
            'cd_estado_trans
            '
            Me.cd_estado_trans.BackColor = System.Drawing.SystemColors.ControlLight
            Me.cd_estado_trans.Desde = ""
            Me.cd_estado_trans.Hasta = "zzzzzzzzzz"
            Me.cd_estado_trans.Location = New System.Drawing.Point(152, 88)
            Me.cd_estado_trans.LvCampo = "cd_estado_trans"
            Me.cd_estado_trans.LvTabla = "wld_estados_transac"
            Me.cd_estado_trans.LvWhere = Nothing
            Me.cd_estado_trans.Name = "cd_estado_trans"
            Me.cd_estado_trans.Size = New System.Drawing.Size(248, 20)
            Me.cd_estado_trans.TabIndex = 3
            Me.cd_estado_trans.Valida = False
            '
            'cd_proveedor
            '
            Me.cd_proveedor.BackColor = System.Drawing.SystemColors.ControlLight
            Me.cd_proveedor.Desde = ""
            Me.cd_proveedor.Hasta = "zzzzzzzzzz"
            Me.cd_proveedor.Location = New System.Drawing.Point(152, 40)
            Me.cd_proveedor.LvCampo = "cd_proveedor"
            Me.cd_proveedor.LvTabla = "kad_proveedores"
            Me.cd_proveedor.LvWhere = Nothing
            Me.cd_proveedor.Name = "cd_proveedor"
            Me.cd_proveedor.Size = New System.Drawing.Size(248, 20)
            Me.cd_proveedor.TabIndex = 0
            Me.cd_proveedor.Valida = False
            '
            'cd_centro_costo
            '
            Me.cd_centro_costo.BackColor = System.Drawing.SystemColors.ControlLight
            Me.cd_centro_costo.Desde = ""
            Me.cd_centro_costo.Hasta = "zzzzzzzzzz"
            Me.cd_centro_costo.Location = New System.Drawing.Point(152, 112)
            Me.cd_centro_costo.LvCampo = "cd_centro_costo"
            Me.cd_centro_costo.LvTabla = "kad_centro_costos"
            Me.cd_centro_costo.LvWhere = Nothing
            Me.cd_centro_costo.Name = "cd_centro_costo"
            Me.cd_centro_costo.Size = New System.Drawing.Size(248, 20)
            Me.cd_centro_costo.TabIndex = 4
            Me.cd_centro_costo.Valida = False
            '
            'cd_transaccion
            '
            Me.cd_transaccion.BackColor = System.Drawing.SystemColors.ControlLight
            Me.cd_transaccion.Desde = ""
            Me.cd_transaccion.Hasta = "zzzzzzzzzz"
            Me.cd_transaccion.Location = New System.Drawing.Point(152, 16)
            Me.cd_transaccion.LvCampo = "cd_transaccion"
            Me.cd_transaccion.LvTabla = "wad_transacciones"
            Me.cd_transaccion.LvWhere = Nothing
            Me.cd_transaccion.Name = "cd_transaccion"
            Me.cd_transaccion.Size = New System.Drawing.Size(248, 20)
            Me.cd_transaccion.TabIndex = 5
            Me.cd_transaccion.Valida = False
            '
            'fe_devengamiento
            '
            Me.fe_devengamiento.BackColor = System.Drawing.SystemColors.ControlLight
            Me.fe_devengamiento.Desde = New Date(2000, 1, 1, 0, 0, 0, 0)
            Me.fe_devengamiento.Hasta = New Date(2000, 1, 1, 0, 0, 0, 0)
            Me.fe_devengamiento.Location = New System.Drawing.Point(152, 64)
            Me.fe_devengamiento.Name = "fe_devengamiento"
            Me.fe_devengamiento.Size = New System.Drawing.Size(176, 20)
            Me.fe_devengamiento.TabIndex = 6
            '
            'st_contabilizado
            '
            Me.st_contabilizado.ForeColor = System.Drawing.SystemColors.ActiveCaption
            Me.st_contabilizado.Location = New System.Drawing.Point(152, 140)
            Me.st_contabilizado.Name = "st_contabilizado"
            Me.st_contabilizado.Size = New System.Drawing.Size(184, 24)
            Me.st_contabilizado.TabIndex = 13
            Me.st_contabilizado.Text = "Contabilizado"
            '
            'Transacciones
            '
            Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
            Me.BackgroundImage = CType(resources.GetObject("$this.BackgroundImage"), System.Drawing.Image)
            Me.ClientSize = New System.Drawing.Size(564, 384)
            Me.Name = "Transacciones"
            Me.Contenedor.ResumeLayout(False)
            CType(Me.lnk_dataSet, System.ComponentModel.ISupportInitialize).EndInit()

        End Sub

#End Region

        'Este evento se dispara al cargar el formulario
        Private Sub KLtransacciones_OnLoadForm(ByRef reportCollection As StartFrame.US.Listador.Reports) Handles MyBase.OnLoadForm

            Try
                'Asigna valor predeterminado de fecha
                Dim fecha As ISql = CType(RemotingHelper.getObject(GetType(ISql)), ISql)
                fe_devengamiento.Hasta = fecha.GetDate(ISql.Formato.Fecha)

                'MPM - 21-06-2005
                Me.fe_devengamiento.Desde = fecha.GetDate(ISql.Formato.Fecha)

                'Agrega los reportes
                Dim rpt As Report
                Dim rangocd_transaccion As New Rango(1, "cd_transaccion", cd_transaccion)
                Dim rangocd_proveedor As New Rango(2, "cd_proveedor", cd_proveedor)
                Dim rangofe_devengamiento As New Rango(3, "fe_devengamiento", fe_devengamiento)
                Dim rangocd_estado_trans As New Rango(4, "cd_estado_trans", cd_estado_trans)
                Dim rangocd_centro_costo As New Rango(5, "cd_centro_costo", cd_centro_costo)
                Dim rangost_contabilizado As New Rango(6, "st_contabilizado", st_contabilizado)

                'Resumido
                rpt = New Report(1, "kltransacciones_resumido", "Resumido", "kltransacciones_resumido", "US.spmc.compras.reportes")
                With rpt.Rangos
                    .Add(rangocd_transaccion)
                    .Add(rangocd_proveedor)
                    .Add(rangofe_devengamiento)
                    .Add(rangocd_centro_costo)
                    .Add(rangost_contabilizado)
                End With
                reportCollection.Add(rpt)

                'Agrupado
                rpt = New Report(2, "kltransacciones_agrupado", "Agrupado", "kltransacciones_agrupado", "US.spmc.compras.reportes")
                With rpt.Rangos
                    .Add(rangocd_transaccion)
                    .Add(rangocd_proveedor)
                    .Add(rangofe_devengamiento)
                    .Add(rangocd_estado_trans)
                    .Add(rangocd_centro_costo)
                End With
                reportCollection.Add(rpt)

                'Detallado
                rpt = New Report(3, "kltransacciones_detallado", "Detallado", "kltransacciones_detallado", "US.spmc.compras.reportes")
                With rpt.Rangos
                    .Add(rangocd_transaccion)
                    .Add(rangocd_proveedor)
                    .Add(rangofe_devengamiento)
                    .Add(rangocd_estado_trans)
                    .Add(rangocd_centro_costo)
                End With
                reportCollection.Add(rpt)

                ''Transacciones pendientes
                'rpt = New Report(4, "kltransacciones_transacpend", "Pendientes", "kltransacciones_transacpend", "US.spmc.compras.reportes")
                'With rpt.Rangos
                '    .Add(rangocd_transaccion)
                '    .Add(rangocd_proveedor)
                '    .Add(rangofe_devengamiento)
                '    .Add(rangocd_centro_costo)
                'End With
                'reportCollection.Add(rpt)

                'Referencia el objeto de negocios relacionado
                _Transacciones = CType(RemotingHelper.getObject(GetType(ITransaccionesCpras)), ITransaccionesCpras)
                Me.ObjetoReglasNegocio = _Transacciones

            Catch ex As Exception
                StartFrame.US.Display.ShowError(ex.Message)
            End Try
        End Sub

    End Class

End Namespace